package com.teampower.idea.action;

import java.util.List;

import com.teampower.idea.action.builder.SysFunctionsBuilder;
import com.teampower.idea.base.BaseAction;
import com.teampower.idea.service.SysFunctionsService;

public class MenuListAction extends BaseAction {

	protected String nid;

	public String getNid() {
		return nid;
	}
	public void setNid(String nid) {
		this.nid = nid;
	}
	
	//返回主菜单
	public void getMenuMain() throws Exception {
		if (logger.isDebugEnabled()) {
			logger.debug("Entering 'MenuListAction.getMenuMain' method");
		}
		SysFunctionsService sysfunctions = (SysFunctionsService) getBean("sysFunctionsService");
		List list = sysfunctions.getAll();
		String json = SysFunctionsBuilder.getAll(list);
		setJson(json);
		write();
	}
	
	//返回子菜单
	public void getMenuSub() throws Exception{
		if (logger.isDebugEnabled()) {
			logger.debug("Entering 'MenuListAction.getMenuSub' method");
		}
			SysFunctionsService sysfunctions = (SysFunctionsService) getBean("sysFunctionsService");
			List list = sysfunctions.getAll(getNid());
			String json = SysFunctionsBuilder.getAll(list);
			setJson(json);
			write();
	}
	
}